package com.hmall.trade.controller.inner;

import com.hmall.trade.service.IOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("inner")
@RequiredArgsConstructor
public class OrderControlInner {
    private final IOrderService orderService;
    //获取订单状态
    @GetMapping("{orderId}")
    Integer getStatus(@PathVariable("orderId") Long orderId){
        return orderService.getStatus(orderId);
    }
    //修改订单状态
    @PutMapping("/orders/{orderId}")
    void  putStatus(@PathVariable("orderId") Long orderId,@RequestParam("status") Integer status){
        orderService.setStatus(orderId,status);
    }
    //取消订单
    @DeleteMapping("/order/delete")
    void  remove(@RequestParam Long orderId){
        orderService.cancelOrder(orderId);
    }
}
